home *** CD-ROM | disk | FTP | other *** search
/ Sounds Terrific 1 / Sounds Terrific CD (1994)(Weird Science)(Disc 2 of 2)[!][Amiga-PC].iso / modules / e / edpromp2.mod < prev    next >
Text File  |  1994-08-04  |  7KB  |  169 lines

  1. 6EDPROM
  2. Frank Reid #1 @9703
  3. Tue Dec 03 19:25:41 1991
  4. EDPROMP2.MOD - Upgrade to EDPROMPT - Change prompt strings from within BBS
  5.                by Untouchable #1 @9804
  6.  
  7. This is an upgrade to EDPROMPT.  To install, you NEED EDPROMPT.MOD.  This
  8. makes a minor modification to MSGBASE.C to read the current message
  9. number, and other than that, just replace the void readprompt() you have
  10. with this one.
  11.  
  12. Go to the end of this mod for IMPORTANT notes.
  13.  
  14. In BBS.C, delete the void readprompt() you have, and add this block.
  15. Remember to add the extern int.
  16.  
  17. extern int messagenumber;
  18.  
  19. void readprompt(char *string)
  20. /* This routine reads a string, filters out the acceptable '@' commands,
  21.    and prints out the result.  This can pretty much be used anywhere. */
  22. {
  23.       int i;
  24.       char s[81];
  25.  
  26.       for (i=0;i<strlen(string);i++) {
  27.             if (string[i]!='@')
  28.                    outchr(string[i]);
  29.         else {
  30.                    i++;
  31.                    switch (string[i]) {
  32.                         case 'S': /* subboard name */
  33.                              outstr(subboards[usub[cursub].subnum].name);
  34.                              break;
  35.                         case 'D': /* directory name */
  36.                              outstr(directories[udir[curdir].subnum].name);
  37.                              break;
  38.                         case 's': /* subboard number */
  39.                              outstr(usub[cursub].keys);
  40.                              break;
  41.                         case 'd': /* directory number */
  42.                              outstr(udir[curdir].keys);
  43.                              break;
  44.                         case 'u': /* time used (minutes) */
  45.                              real_tl(0);
  46.                              break;
  47.                         case 'l': /* time left (minutes) */
  48.                              real_tl(1);
  49.                              break;
  50.                         case 'n': /* user's name and number */
  51.                              outstr(nam(&thisuser,usernum));
  52.                              break;
  53.                         case 'r': /* go to next line */
  54.                              nl();
  55.                              break;
  56.                         case 'c': /* current baud rate */
  57.                              outstr(curspeed);
  58.                              break;
  59.                         case 'x': /* ANSI escape character */
  60.                              if (okansi())
  61.                                  outchr(27);
  62.                              break;
  63.                         case 'g': /* beep!  control-G */
  64.                              outchr(7);
  65.                              break;
  66.                         case 'A': /* user's SL */
  67.                              itoa(thisuser.sl,s,10);
  68.                              outstr(s);
  69.                              break;
  70.                         case 'a': /* user's DSL */
  71.                              itoa(thisuser.dsl,s,10);
  72.                              outstr(s);
  73.                              break;
  74.                         case 't': /* user's gold */
  75.                              itoa(thisuser.gold,s,10);
  76.                              outstr(s);
  77.                              break;
  78.                         case 'M': /* current message number */
  79.                              itoa(messagenumber,s,10);
  80.                              outstr(s);
  81.                              break;
  82.                         case 'm': /* number of messages in sub */
  83.                              itoa(nummsgs,s,10);
  84.                              outstr(s);
  85.                              break;
  86.                         case 'f': /* upload to download ratio */
  87.                              sprintf(s,"%-6.3f",ratio());
  88.                              outstr(s);
  89.                              break;
  90.                         case 'p': /* post to call ratio */
  91.                              sprintf(s,"%-6.3f",
  92.                              (double)thisuser.msgpost/(double)thisuser.logons);
  93.                              outstr(s);
  94.                              break;
  95.                         default : /* anything else */
  96.                              outchr('@');
  97.                              break;
  98.                    }
  99.              }
  100.       }
  101. }
  102.  
  103. Now load MSGBASE.C and after the extern voids, add this line:
  104.  
  105. int messagenumber;
  106.  
  107. Now skip down to void read_message, and make the following change in the
  108. beginning.
  109.  
  110.         messagenumber=n;    /* add this */
  111.         abort=0;            /* existing */
  112.         *next=0;            /* existing */
  113.  
  114. Now you're done - you may wish to make a list of all the commands and have
  115. it print out before you edit - a little too much to remember now.
  116.  
  117. IMPORTANT NOTES.
  118.  
  119. If you want to make the size of the prompts bigger, you MUST do so when
  120. you FIRST install the mod, otherwise STATUS.DAT will crash.  Keep in mind
  121. that each byte you add to it, adds to DGROUP, so making mainprompt[81]
  122. mainprompt[101], you've just added 20 bytes of DGROUP.  REMEMBER : you
  123. must also change void editgiven so that you can still input beyond 80
  124. characters - otherwise the increased size won't do any good.
  125.  
  126. Adding prompts is incredibly easy.  Currently, I have 11 prompt strings
  127. that are read through this.  Simply follow the same format.  Keep in mind
  128. this was not designed to save DGROUP, it will COST DGROUP.  However it
  129. will allow EASY editing of prompts, that is its main purpose, along with
  130. making BBS softwares like Telegard obsolete. (that hasn't happened
  131. already?)
  132.  
  133. If you make any enhancements to this mod, feel free to post it on the
  134. Modnet - there's a never ending list of things you can put in here.  Its
  135. not limited to prompts either - with alot of variables, its possible,
  136. possible, to put entire functions such as 'Y'our information into a
  137. readprompt(). ie:
  138.  
  139.         readprompt("Your gold: @t");
  140.  
  141. ...and that would be repeated throughout the entire function.
  142.  
  143. You don't have to use readprompt only on status.xxx variables - it can
  144. read strings directly from the BBS, or even an external strings manager.
  145. ie, for RR5:
  146.  
  147.         prt_string(s,666);
  148.         readprompt(s);
  149.  
  150. or for ESM:
  151.  
  152.         strcpy(s,get_string(666));
  153.         readprompt(s);
  154.  
  155. Don't know about other string managers - I'm not familiar with them.  I
  156. don't use any myself.
  157.  
  158. ...and now I shall move on to other mods, and pretty much abandon this one
  159. unless there's a need for it.
  160.  
  161. Untouchable (1@9804)
  162. The King's Crown - 908/238-4193 at 3/12/24/9600 baud V32.
  163. Auto-Sysop Validation, 22+ Megs WWIV Files, 800+ Mods, PCPursuitable NJNBR.
  164.  
  165. Other mods by me: SCROLL, SHOWBDAY, CHATCMMD, TIMEMSG, CURTTL, CAPNAME,
  166. FINDSYS, THRUSYS, WORD, CFGLIST, F1VALID, ANSICFG, MINUTES, ANSIFX, and of
  167. course EDPROMPT.
  168.  
  169.